package org.example.ThreadPool.Executors;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.IntStream;

public class newFixedThreadPoolSty {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(3);
        executorService.submit(() -> {
            IntStream.range(0, 50).forEach(i -> {
                System.out.println(Thread.currentThread().getName());
            });
        });
        executorService.shutdown(); // 关闭线程池,不再接受新的任务，等待已提交的任务执行完毕关闭
    }

}
